package com.baomidou.springmvc.model.enums;

import java.io.Serializable;

import com.baomidou.mybatisplus.enums.IEnum;

public enum PrizeTypeEnum implements IEnum{
	
	/**
	 * 特等
	 */
	UTR(0,"特等奖"),
	/**
	 * 一等奖
	 */
	SSR(1,"一等奖"),
	/**
	 * 二等奖
	 */
	SR(2,"二等奖"),
	/**
	 * 三等奖
	 */
	R(3,"三等奖"),
	/**
	 * 参与奖
	 */
	N(4,"参与奖"),
	
	DONE_EXCHANGE(401,"已兑换"),
	NO_EXCHANGE(400,"未兑换"),
	;
	
	private final int value;
    private final String desc;

    PrizeTypeEnum(final int value, final String desc) {
        this.value = value;
        this.desc = desc;
    }
	@Override
	public Serializable getValue() {
		 return this.value;
	}

	public int getVal() {
		return this.value;
	}
	// Jackson 注解为 JsonValue 返回中文 json 描述
    public String getDesc() {
        return this.desc;
    }
    
    
    public static PrizeTypeEnum getByMsg(String msg) {
    	for (PrizeTypeEnum e : values()) {
			if (e.getDesc().equals(msg)) {
				return e;
			}
		}
    	return null;
    }
}
